import request from '@neu/biz-core/utils/request'
const baseUrl = '/dcam/api/w/asset/stats'

export const list = (category, timeDim, params) => {
  return request({
    url: baseUrl + '/' + category + '/' + timeDim,
    params,
    method: 'get'
  })
}

export const personalStats = (params) => {
  return request({
    url: baseUrl + '/personal',
    params,
    method: 'get'
  })
}

export const inventoryStats = (params) => {
  return request({
    url: baseUrl + '/inventory',
    params,
    method: 'get'
  })
}

export const exportCommonReportExcel = (category, timeDim) => {
  return (params) => {
    return request({
      url: baseUrl + '/' + category + '/' + timeDim + '/export',
      params,
      method: 'get',
      responseType: 'blob',
      headers: {
        'Content-Type': 'application/octet-stream'
      }
    })
  }
}

export const exportCommonReportPdf = (category, timeDim) => {
  return (params) => {
    return request({
      url: baseUrl + '/' + category + '/' + timeDim + '/export/pdf',
      params,
      method: 'get',
      responseType: 'blob',
      headers: {
        'Content-Type': 'application/octet-stream'
      }
    })
  }
}

export const exportPersonalReportExcel = () => {
  return (params) => {
    return request({
      url: baseUrl + '/personal/export',
      params,
      method: 'get',
      responseType: 'blob',
      headers: {
        'Content-Type': 'application/octet-stream'
      }
    })
  }
}

export const exportPersonalReportPdf = () => {
  return (params) => {
    return request({
      url: baseUrl + '/personal/export/pdf',
      params,
      method: 'get',
      responseType: 'blob',
      headers: {
        'Content-Type': 'application/octet-stream'
      }
    })
  }
}

export const exportInventoryReportExcel = () => {
  return (params) => {
    return request({
      url: baseUrl + '/inventory/export',
      params,
      method: 'get',
      responseType: 'blob',
      headers: {
        'Content-Type': 'application/octet-stream'
      }
    })
  }
}

export const exportInventoryReportPdf = () => {
  return (params) => {
    return request({
      url: baseUrl + '/inventory/export/pdf',
      params,
      method: 'get',
      responseType: 'blob',
      headers: {
        'Content-Type': 'application/octet-stream'
      }
    })
  }
}
